<?php

namespace App\Model;

use EasySwoole\ORM\AbstractModel;

/**
 * SystemConfigModel
 * Class SystemConfigModel
 * Create With ClassGeneration
 * @property int $id // 配置ID
 * @property string $name //
 * @property string $value // 配置值
 * @property int $group // 配置分组
 * @property int $need_auth // 1需要登录后才能获取，0不需要登录即可获取
 */
class SystemConfigModel extends AbstractModel
{
	protected $tableName = 'tv_system_config';


	public function getList(int $page = 1, int $pageSize = 10, string $field = '*'): array
	{
		$list = $this
		    ->withTotalCount()
			->order($this->schemaInfo()->getPkFiledName(), 'DESC')
		    ->field($field)
		    ->page($page, $pageSize)
		    ->all();
		$total = $this->lastQueryResult()->getTotalCount();;
		return ['total' => $total, 'list' => $list];
	}
}

